<script setup>
const route = useRoute();
import userPinia from "~/pinia/user";
const userStore = userPinia();
const { isShowLogin } = toRefs(userStore);
const closeDialog = () => {
  userStore.setLoginDialog(false);
};
const login = () => {
  const myToken = useCookie("myToken");
  myToken.value = "nuxt-token";
  closeDialog();
};
</script>

<template>
  <HeaderNav></HeaderNav>
  <div class="overflow-auto">
    <slot></slot>
  </div>
  <FooterNav v-show="route.path !== '/download'"></FooterNav>
  <ClientOnly>
    <UModal
      v-model="isShowLogin"
      prevent-close
      :ui="{
        overlay: {
          background: 'bg-[#000] bg-opacity-60',
        },
        background: 'bg-[#141623]',
        width: 'w-[400px]',
      }"
    >
      <div class="p-4">
        <div class="flex justify-between">
          <div class="text-[16px] opacity-70">用户登录</div>
          <div>
            <UIcon
              @click="closeDialog"
              name="i-heroicons-x-mark"
              :class="['w-6 h-6 opacity-70 cursor-pointer']"
            />
          </div>
        </div>
        <div class="mt-5 flex justify-center">
          <UButton @click="login">一键登录</UButton>
        </div>
      </div>
    </UModal>
  </ClientOnly>
</template>
